<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>JavaScript 字符串方法</title>
</head>
<body>
<h2>slice()</h2>
<p>如果省略第二个参数，则该方法将裁剪字符串的剩余部分：</p>

<p id="demo"></p>

<script>
  var str = "Apple, Banana, Mango";
  var res = str.slice(7);
  document.getElementById("demo").innerHTML = res;
</script>
</body>
</html>

<!--
输出结果：Banana, Mango

或者从结尾计数：
var res = str.slice(-13);
输出结果：Banana, Mango
-->